How to create custom ranking attributes according to your business needs, based on your own metrics, like sales or popularity.
likes
and retweets
.
You can do this by using Algolia’s custom ranking feature to specify what attributes to rank on. You can configure these attributes at indexing time with the customRanking
parameter or through Algolia’s dashboard.
customRanking
during indexing time.
You can set custom ranking criteria to be in ascending or descending order.
customRanking
list are pushed to the bottom. For example, say you want to add Facebook posts to your dataset, and they have attributes likes
and comments
. Because retweets
are a custom ranking attribute, and Facebook posts don’t have a retweets
attribute, they’re unlikely to win the tie-break against a tweet.
You could solve this by creating a computed attribute. For example, you could compute a single popularity attribute instead of having likes
and retweets
on one side and likes
and comments
on the other.
popularity
being the sum of likes
and retweets
).null
.browse
method.partialUpdateObjects
method.customRanking
depends on your use case and what data you have available. Some retail metrics commonly used in customRanking
include sales rank, stock levels, free shipping (boolean), on sale (boolean), and rating. Publish date (as a timestamp), page views, and likes are often used in media applications.
customRanking
aren’t formatted as a string, as this would cause the records to be ranked alphabetically.